* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

a {
  text-decoration: none;
}

li {
  list-style: none;
}

/* 自定义全局变量 */
:root {
  --clr: #222327;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 这里设置最小高度 */
  min-height: 100vh;
  background: var(--clr);
}

.nav {
  width: 400px;
  height: 70px;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.nav ul {
  position: relative;
  display: flex;
  width: 350px;
}

.nav ul li {
  z-index: 1;
  width: 70px;
  height: 70px;
  /* background-color: pink; */
}

.nav ul li a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* background-color: skyblue; */
  text-align: center;
  font-weight: 500px;
}

.nav ul li a .icon {
  display: block;
  /* background-color: tan; */
  font-size: 1.5em;
  line-height: 75px;
  color: var(--clr);
  transition: all 0.3s linear;
}

.nav ul li.active a .icon {
  transform: translateY(-35px);
}

.nav ul li a .text {
  position: absolute;
  color: var(--clr);
  font-weight: 400px;
  font-size: 0.85em;
  letter-spacing: 0.08em;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s linear;
}

.nav ul li.active a .text {
  opacity: 1;
  transform: translateY(5px);
}

.indicator {
  position: absolute;
  top: -50%;
  width: 70px;
  height: 70px;
  background-color: #29fd53;
  border-radius: 50%;
  border: 6px solid var(--clr);
  transition: all 0.5s ease-in-out;
}

.indicator::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -22px;
  width: 20px;
  height: 20px;
  background-color: #fff;
  border-top-right-radius: 20px;
  box-shadow: 1px -10px 0 0 var(--clr);
}

.indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -22px;
  width: 20px;
  height: 20px;
  background-color: #fff;
  border-top-left-radius: 20px;
  box-shadow: -1px -10px 0 0 var(--clr);
}

/* ~ 后续兄弟选择器 */
.nav ul li:nth-child(1).active ~ .indicator {
  transform: translateX(calc(70px * 0));
}
.nav ul li:nth-child(2).active ~ .indicator {
  transform: translateX(calc(70px * 1));
}
.nav ul li:nth-child(3).active ~ .indicator {
  transform: translateX(calc(70px * 2));
}
.nav ul li:nth-child(4).active ~ .indicator {
  transform: translateX(calc(70px * 3));
}
.nav ul li:nth-child(5).active ~ .indicator {
  transform: translateX(calc(70px * 4));
}
